import request from '@/utils/request'

export function list(query) {
  return request({
    url: '/admin/v1/dict-items/list',
    method: 'get',
    params: query
  })
}

export function listByDictCode(dictCode) {
  return request({
    url: '/admin/v1/dict-items',
    method: 'get',
    params: { dictCode: dictCode, queryMode: 'list' }
  })
}

export function detail(id) {
  return request({
    url: `/admin/v1/dict-items/${id}`,
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: '/admin/v1/dict-items/add',
    method: 'post',
    data
  })
}

export function update(data) {
  return request({
    url: '/admin/v1/dict-items/update',
    method: 'put',
    data
  })
}

export function updateStatus(id, data) {
  return request({
    url: `/admin/v1/dict-items/update/${id}`,
    method: 'put',
    data
  })
}

export function del(data) {
  return request({
    url: '/admin/v1/dict-items/delete',
    method: 'delete',
    data
  })
}
